/* eslint-disable max-classes-per-file */
import { JsonProperty, Serializable } from '@/plugins/reflect-metadata';

@Serializable()
export class RealAuthConfig {
  @JsonProperty('certNo')
    certNo: string = '';

  @JsonProperty('certName')
    certName: string = '';

  @JsonProperty('metaInfo')
    metaInfo: any = {};

  get query() {
    return {
      certNo: this.certNo,
      certName: this.certName,
      metaInfo: this.metaInfo,
    };
  }

  // eslint-disable-next-line class-methods-use-this
  get code() {
    return {
      code: Math.floor(Math.random() * 90000) + 10000,
    };
  }
}

@Serializable()
export class RealAuthLunchRes {
  @JsonProperty('certifyUrl')
    certifyUrl: string = '';

  @JsonProperty('certifyId')
    certifyId: string = '';
}

@Serializable()
export class RealAuthCertifyRes {
  @JsonProperty('certifyId')
    certifyId: string = '';
}

@Serializable()
export class RealAuthResponse {
  @JsonProperty('code')
    code: number = 0;

  @JsonProperty('subCode')
    subCode: string = '';

  @JsonProperty('reason')
    reason : string = '';

  @JsonProperty({ name: 'extInfo', type: RealAuthCertifyRes })
    extInfo: RealAuthCertifyRes = new RealAuthCertifyRes();
}

@Serializable()
export default class RealAuth {
  @JsonProperty({ name: 'response', type: RealAuthResponse })
    response: RealAuthResponse = new RealAuthResponse();
}
